<?php
require_once '../../includefiles.php';
require_once '../../model/trade.php';

$objTrade = new Model_TRADE();
$allsubcats = $objTrade->getAllSubcats();
//check selected

$regcats = $_SESSION['pregister']['cats'];
if($regcats)
{
	$singles = array();
	foreach($regcats as $cat)
		foreach($cat['data'] as $sub)
			$singles[] = $sub['id'];	
			
	for($i=0;$i<count($allsubcats);$i++)
		for($j=0;$j<count($allsubcats[$i]['data']); $j++)
		{
			$allsubcats[$i]['data'][$j]['selected'] = 0;	
			if(in_array($allsubcats[$i]['data'][$j]['id'],$singles))
				$allsubcats[$i]['data'][$j]['selected']	=1;
		}
}


$tradejobtypeArray = $objTrade->getAllJobTypeWithActiveStatus();
foreach($tradejobtypeArray as $tradejobtypeArray)
{	
	$newarray[] =	$tradejobtypeArray['parent_id'];
}
	
$tradecategoryArray = array_values(array_unique($newarray));
if($tradecategoryArray[0]!='')
{
		$imopldeids = @implode(",",$tradecategoryArray);
		$newtradecatArray = $objTrade->getAllTradesCategoryWithmultipleId($imopldeids);
}
//echo "<pre>";print_R($tradecatArray);die();
$smarty->assign("newtradecategoryArray", $newtradecatArray);


$tradejobtypeArray = $objTrade->getAllJobTypeWithActiveStatus();
$smarty->assign("tradejobtypeArray", $tradejobtypeArray);

//Active Class

$active = 'findajob';
$smarty->assign('active', $active);
$smarty->assign('subcats',$allsubcats);
$smarty->assign('register',1);
$smarty->display(TEMPLATEDIR . '/modules/register/register2.tpl');
unset($smarty);
?>